package com.test.design.material.materialdesign;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.airbnb.lottie.LottieAnimationView;

/**
 * author:harisucici on 2018/8/7 11:58
 * email:harisucici@gmail.com
 * name:
 * todo:
 */
public class LottieActivity extends AppCompatActivity {
    private LottieAnimationView animation_view;
    private Button start,pause,resume,stop,reverse;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lottie);
        animation_view = findViewById(R.id.animation_view);
        start = findViewById(R.id.start);
        pause = findViewById(R.id.pause);
        resume = findViewById(R.id.resume);
        stop = findViewById(R.id.stop);
        reverse = findViewById(R.id.reverse);
        start.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               animation_view.playAnimation();//开始播放动画

           }
        });
        pause.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               animation_view.pauseAnimation();//开始播放动画

           }
        });
        resume.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               animation_view.resumeAnimation();//开始播放动画

           }
        });
        stop.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               animation_view.cancelAnimation();//开始播放动画

           }
        });
        reverse.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               animation_view.playAnimation();//开始播放动画

           }
        });

    }
}
